#!/bin/bash
#
Prog="test"
case "$1" in
start)
    touch /var/lock/subsys/$Prog
    echo "starting $Prog is ok"
    ;;
stop)
    rm -f /var/lock/subsys/$Prog
    echo "stopping $Prog is ok"
    ;;
restart)
    if [ ! -f /var/lock/subsys/$Prog ];then
	touch /var/lock/subsys/$Prog
    fi
    rm -f /var/lock/subsys/$Prog
    touch /var/lock/subsys/$Prog
    ;;
status)
    if [ -f /var/lock/subsys/$Prog ];then
	echo "$Prog is running"
    else
        echo "$Prog is stopped"
    fi
     ;;
*)
  echo "Usage: $0 {start|stop|restart|status}"
esac
